<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.wlcorp.forcazamis.domain.baseinfo.SampleType" %>
<%@ page import="com.wlcorp.forcazamis.domain.baseinfo.Feature" %>
<%@ page import="com.wlcorp.forcazamis.domain.baseinfo.Factory" %>
<%
	List sampleTypeList = (List)request.getAttribute("sampleTypeList");
	List featureList = (List)request.getAttribute("featureList");
	List factoryList = (List)request.getAttribute("factoryList");
%>
<html>
<head>
	<title>产品编码生成</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0">
	<link href="${pageContext.request.contextPath}/css/css.css" rel=stylesheet>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/button_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/form_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/table_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagetitle_css.css" type="text/css">
	<script language="javascript" src="${pageContext.request.contextPath}/script/ajax.js"></script>
	<script type="text/javascript">
		function createSerial(){
			var sampleTypeCode = document.forms["calForm"].sampleType.value;
			var featureCode = document.forms["calForm"].feature.value;
			var factoryCode = document.forms["calForm"].factory.value;
			var sampleCode = "";
			var sUrl = "${pageContext.request.contextPath}/sample/sampleManager.do?method=getSameTypeNewSerialCode&sampleCode=" + sampleCode;
			ajaxRead(sUrl,function(obj){
				var serialCode = obj.responseText;
				sampleCode = factoryCode + serialCode + sampleTypeCode + featureCode
				//sampleCode = sampleCode + serialCode;
				document.forms["calForm"].serialCode.value = serialCode;
				document.forms["calForm"].sampleCode.value = sampleCode;
			});
		}
		function getSerial(){
			window.dialogArguments.document.getElementById('sampleCode').value = document.forms["calForm"].sampleCode.value;
			window.dialogArguments.document.getElementById('serialCode').value = document.forms["calForm"].serialCode.value;
		}
	</script>
</head>
<body>
<form name="calForm" method="POST" action="${pageContext.request.contextPath}/baseinfo/customerManager.do?method=modifyCustomer">
<input name="serialCode" type="hidden" value=""/>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="30">
	<tr> 
	  <td width="22" class="page_titlebar_head">&nbsp;</td>
	  <td class="page_titlebar_bg" width="100%">产品编码生成</td>
	</tr>
</table>
<table width="100%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="sampleType_TEXT">产品类别</td>
		<td width="80%">&nbsp;
			<select name="sampleType" style="width:100px">
				<%
					for(Iterator iter = sampleTypeList.iterator();iter.hasNext();){
						SampleType sampleType = (SampleType)iter.next();
						
				%>
				<option value="<%=sampleType.getSampleTypeCode()%>">[<%=sampleType.getSampleTypeCode()%>]<%=sampleType.getSampleTypeName()%></option>
				<%}%>
			</select>
		</td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="feature_TEXT">产品特性</td>
		<td width="80%">&nbsp;
			<select name="feature" style="width:100px">
				<%
					for(Iterator iter = featureList.iterator();iter.hasNext();){
						Feature feature = (Feature)iter.next();
						
				%>
				<option value="<%=feature.getFeatureCode()%>">[<%=feature.getFeatureCode()%>]<%=feature.getFeatureName()%></option>
				<%}%>
			</select>
		</td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="sampleType_TEXT">工厂</td>
		<td width="80%">&nbsp;
			<select name="factory" style="width:100px">
				<%
					for(Iterator iter = factoryList.iterator();iter.hasNext();){
						Factory factory = (Factory)iter.next();
						
				%>
				<option value="<%=factory.getFactoryCode()%>">[<%=factory.getFactoryCode()%>]<%=factory.getFactoryName()%></option>
				<%}%>
			</select>
		</td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="sampleCode_TEXT">产品编码</td>
		<td width="80%">&nbsp;
			<input name="sampleCode" type="text" class="input" value="" readonly/>
		</td>
  </tr>
  <tr class="InputFrameLine">
  	<td width="100%" colspan="4" align="center">
  		<input type="button" class="button_common" name="createSerial_button" value="生成编码" onclick="javascript:createSerial()">
  		<input type="button" class="button_common" name="getSerial_button" value="提取编码" onclick="javascript:getSerial();">
  		<input type="button" class="button_common" name="close_button" value="关闭窗口" onclick="javascript:window.close();">
  	</td>
  </tr>
</table>
</form>
</body>
</html>
